//package com.lzy.wzy;
//
//import com.dingtalk.api.DefaultDingTalkClient;
//import com.dingtalk.api.DingTalkClient;
//import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
//import com.dingtalk.api.request.OapiUserGetByMobileRequest;
//import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
//import com.dingtalk.api.response.OapiUserGetByMobileResponse;
//import com.google.gson.Gson;
//import com.lzy.wzy.config.MyPasswordEncoder;
//import com.lzy.wzy.service.imp.DingdingService;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang.StringUtils;
//import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//
//@SpringBootTest
//public class MyTest {
////    @Autowired
////    private UserMapper userMapper;
////
////    @Autowired
////    private WorkMapper workMapper;
////
////    @Autowired
////    private TemplateMapper templateMapper;
////
//
//    @Autowired
//    private Gson gson;
//
//    @Autowired
//    private MyPasswordEncoder myPasswordEncoder;
//    @Autowired
//    private DingdingService dingdingService;
//    @Test
//    public void test() throws Exception {
////        Boolean sendResult = false;
////        // 开始获取钉钉Access_Token,开启消息通知
////        String accessToken = dingdingService.getAccessToken();
////        // 通知接收人电话号码
////         String mobile = "15096008327";
////        if(StringUtils.isBlank(mobile)){
////            return;
////        }
////        StringBuilder userIdList = new StringBuilder();
////        String[] split = mobile.split(",");
////        for(String cell : split){
////            DingTalkClient client2 = new DefaultDingTalkClient(dingdingService.getGetByMobileUrl());
////            OapiUserGetByMobileRequest req = new OapiUserGetByMobileRequest();
////            req.setMobile(cell);
////            req.setHttpMethod("GET");
////            OapiUserGetByMobileResponse rsp = client2.execute(req, accessToken);
////            // 获取的urid即为发送的目标人员的ID
////            String urid = rsp.getUserid();
////            // 将接受人员的urid按照（user123,user456）的形式拼接
////            userIdList.append(urid).append(",");
////        }
////        DingTalkClient client = new DefaultDingTalkClient(dingdingService.getAsyncMessageUrl());
////        OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request();
////        request.setUseridList(userIdList.toString());
////        request.setAgentId(dingdingService.getAgentId());
////        request.setToAllUser(false);
////        OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
////        // 消息类别时文本消息
////        msg.setMsgtype("text");
////        msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
////        //  msg.getText().setContent("工作通知：你存在未处理的待办任务，请及时处理待办事项！");
////        request.setMsg(msg);
////        // 消息发送
////        OapiMessageCorpconversationAsyncsendV2Response dingResult = client.execute(request, accessToken);
////        System.out.println(gson.toJson(dingResult));
//    }
//
//
//
////    private void b(){
////        int num=1;
////        int pageSize=10;
////        PageHelper.startPage(num, pageSize);
////        List<User> users = userMapper.queryAllUserInfo();
////        PageInfo<User> userPageInfo = new PageInfo<>(users);
////        System.out.println(userPageInfo.getList().size());
////    }
//}
